package com.winit.cloudlink.mgmt.rabbit;

import com.winit.cloudlink.common.URL;
import com.winit.cloudlink.rabbitmq.mgmt.RabbitMgmtService;

import static org.apache.commons.lang3.StringUtils.isNotBlank;

public class BaseAdmin {
    protected RabbitMgmtService rabbitMgmtService;
    protected String virtualHost;

    public BaseAdmin(String url) {
        this(URL.valueOf(url));
    }

    public BaseAdmin(URL url) {
        this(RabbitMgmtServiceHelper.getRabbitMgmtService(url), isNotBlank(url.getPath()) ? url.getPath() : Constants.ROOT_VIRTUAL_HOST);
    }

    public BaseAdmin(RabbitMgmtService rabbitMgmtService, String virtualHost) {
        this.rabbitMgmtService = rabbitMgmtService;
        this.virtualHost = virtualHost;
    }
}
